package revontuli.aMHD.datamanagement;

import java.util.ArrayList;

import revontuli.aMHD.aMHDApp;
import revontuli.aMHD.dataclasses.Stop;

/**
 * Tato trieda ma na starosti stiahnutie dat o zastavkach a ich odovzdanie parseru.
 * @author revontuli
 *
 */
public class StopUpdater {
	protected HTTPRetriever httpRetriever = new HTTPRetriever();
	protected XMLParser xmlParser = new XMLParser();
	
	public ArrayList<Stop> update(Integer rev) {
		StringBuffer sb = new StringBuffer();
		
		sb.append(aMHDApp.DATA_SERVER_URL);
		sb.append(aMHDApp.DATA_STOPLIST_UPDATE_PREFIX);
		sb.append(rev);
		
		String response = httpRetriever.retrieve(sb.toString());
		return xmlParser.parseStopList(response);
	}
}
